import static org.junit.Assert.*;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class SavingsAccountTest {

	SavingsAccount testAccount;
	
	@Before
	public void setUp() throws Exception {
		Customer testCustomer = new Customer("test first name", "test last name", "1234 test street", "test zipcode 12345", "test town olympia", "test country usa");
		testAccount = new SavingsAccount(testCustomer);
	}

	@After
	public void tearDown() throws Exception {
		//do anything to testAccount?
		testAccount = null;
	}

	@Test
	public void testCalculateInterest() {
		testAccount.balance = new BigDecimal(1);
		BigDecimal startBalance = testAccount.balance;
		testAccount.calculateInterest();
		BigDecimal endBalance = testAccount.balance;
		assertEquals(startBalance.compareTo(endBalance),-1);
	}

	@Test
	public void testWithdrawalTrue() {
		testAccount.balance = new BigDecimal(2);
		assertTrue(testAccount.withdrawal(new BigDecimal("1.0")));
	}

	@Test
	public void testWithdrawalFalse() {
		testAccount.balance= new BigDecimal(0);
		assertFalse(testAccount.withdrawal(new BigDecimal("1.0")));
	}

	@Test
	public void testPrint(){
		testAccount.print();
	}
	
}
